package com.xlink.action;


import org.moon.rbac.domain.User;
import org.moon.rbac.domain.annotation.WebUser;
import org.moon.rest.annotation.Get;
import org.moon.utils.Objects;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Cathy on 2015/12/22.
 */
@Controller
public class PageAction {

    @Get("/login.html")
    public ModelAndView showLoginPage(){
        return new ModelAndView("/pages/xlink/login");
    }

    @Get("/register.html")
    public ModelAndView showRegisterPage(){
        return new ModelAndView("/pages/xlink/register");
    }

    @Get("/index.html")
    public ModelAndView showIndexPage(@WebUser User user,
                                      HttpServletRequest request){
        System.out.println(Objects.nonNull(user));

        return new ModelAndView("/pages/xlink/index","currentUser", user);
    }

    @Get("/account.html")
    public ModelAndView showAccountPage(){
        return new ModelAndView("/pages/xlink/account");
    }

    @Get("/developer.html")
    public ModelAndView showDeveloperPage(){
        return new ModelAndView("/pages/xlink/developer");
    }

    @Get("/contact.html")
    public ModelAndView showContactPage(){
        return new ModelAndView("/pages/xlink/contact");
    }

    @Get("/add_device.html")
    public ModelAndView showAddDevicePage(){
        return new ModelAndView("pages/xlink/add_device");
    }

    @Get("/mydevice.html")
    public ModelAndView showlistDevicePage(){
        return new ModelAndView("pages/xlink/mydevice");
    }

    @Get("/manage_device.html")
    public ModelAndView showsingleDevicePage(){
        return new ModelAndView("pages/xlink/manage_device");
    }

    @Get("/edit_device.html")
    public ModelAndView showupdateDevicePage(){return new ModelAndView("pages/xlink/edit_device");}

    @Get("/add_sensor.html")
    public ModelAndView showAddSensorPage(){
        return new ModelAndView("pages/xlink/add_sensor");
    }

    @Get("/edit_sensor.html")
    public ModelAndView showupdateSensorPage(){return new ModelAndView("pages/xlink/edit_sensor");}

    @Get("/devices.html")
    public ModelAndView showdevicesPage(){return new ModelAndView("pages/xlink/devices");}

    @Get("/dev_suc_del.html")
    public ModelAndView showdev_suc_delPage(){return new ModelAndView("pages/xlink/dev_suc_del");}

    @Get("/dev_suc_add.html")
    public ModelAndView showdev_suc_addlPage(){return new ModelAndView("pages/xlink/dev_suc_add");}

    @Get("/dev_suc_edit.html")
    public ModelAndView showdev_suc_editlPage(){return new ModelAndView("pages/xlink/dev_suc_edit");}

    @Get("/sen_suc_add.html")
    public ModelAndView showsen_suc_addlPage(){return new ModelAndView("pages/xlink/sen_suc_add");}

    @Get("/sen_suc_edit.html")
    public ModelAndView showsen_suc_editlPage(){return new ModelAndView("pages/xlink/sen_suc_edit");}

    @Get("/sen_suc_del.html")
    public ModelAndView showsen_suc_delPage(){return new ModelAndView("pages/xlink/sen_suc_del");}

}
